<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>查询结果</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css" />
<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</head>
<body>
	<!-- 头部信息 -->
	<jsp:include page="header.jsp"></jsp:include>
	
	<jsp:include page="order-search.jsp"></jsp:include>
	
	<!-- 内容区域 -->
		<h3 style="text-align: center;">订单详情</h3>
		<div class="container-fluid" style="margin: 30px;">
			<div style="border: 1px solid gray;border-radius: 8px;height: 500px;">
				<!-- 订单详情 -->
				<div class="col-xs-6">
					<div class="col-xs-offset-1">
						<h3>商品列表</h3>
						<table class="table" style="width: 400px;">
							<thead>
								<tr>
									<th>商品编号</th>
									<th>商品名称</th>
									<th>支付金额</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${order.orderItems}" var="orderItem">
									<tr>
									<td>${orderItem.product.productNum}</td>
									<td>${orderItem.product.productName }</td>
									<td>${orderItem.money }</td>
								</tr>
								</c:forEach>
								<tr>
								<td colspan="3" align="right">总金额:${order.totalMoney }</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<!-- 收货信息 -->
				<div class="container">
					<div class="col-xs-offset-8">
						<h3>收货信息</h3>
						<table class="table" style="margin-top: 40px;">
							<tr>
								<th>收货人姓名</th>
								<td>${order.recName}</td>
							</tr>
							<tr>
								<th>联系电话</th>
								<td>${order.recPhone}</td>
							</tr>
							<tr>
								<th>收货地址</th>
								<td>${order.recAddress}</td>
							</tr>
							<tr>
								<th>订单状态</th>
								<td>${order.statusStr}</td>
							</tr>
							<c:if test="${order.status==1}">
								<tr>
								<td colspan="2"align="right"><button class="btn btn-primary" disabled>${order.statusStr}</button></td>
								</tr>
							</c:if>
							
							<c:if test="${order.status==0}">
								<tr>
								<td colspan="2"align="right"><button class="btn btn-primary" onclick="location.href='${pageContext.request.contextPath}/order/updateStatus.do?orderId=${order.orderId}'">发货</button></td>
								</tr>
							</c:if>
							
						</table>
						
					</div>
				</div>

			</div>
		</div>

</body>
</html>